javascript define and call anonymous function